#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os
from flask_script import Manager, Server
from app import create_app

if os.path.exists('etc/config'):
    with open('etc/config') as f:
        for line in f:
            name, value = line.strip().split('=')
            os.environ.setdefault(name, value)


app = create_app(os.environ.get('FLASK_ENV', 'default'))
manager = Manager(app)
manager.add_command('runserver', Server(use_debugger=True, use_reloader=True))

if __name__ == '__main__':
    manager.run()
